import frida
import sys

rdev = frida.get_remote_device()
session = rdev.attach("得物")

scr = """
Java.perform(function () {
 
    var AESEncrypt = Java.use("com.duapp.aesjni.AESEncrypt");
    AESEncrypt.encode.implementation = function(str){
        //console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
        console.log("1.拼接后的参数=",str);
        var res = this.encode(str);
        console.log("4.encode返回值=",res);
        return res;
    }
    
    AESEncrypt.encodeByte.implementation = function(bArr, str){
        console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
        console.log("2.bArr=",bArr);
        console.log("2.str=",str);
        var res = this.encodeByte(bArr, str);
        console.log("3.encodeByte返回值",res);
        return res;
    }
});
"""
script = session.create_script(scr)

def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()
